﻿@{
    ViewBag.Title = "DaySellMinMax";
    Layout = "~/Views/Shared/_Layout.cshtml";
    

}
<style>
    button, input, optgroup, select, textarea {
        color: black;
    }

    #fm {
        margin: 0;
        padding: 10px 10px;
    }

    .ftitle {
        font-size: 14px;
        font-weight: bold;
        color: #666;
        padding: 5px 0;
        margin-bottom: 10px;
        border-bottom: 1px solid #ccc;
    }

    .fitem {
        margin-bottom: 5px;
    }

        .fitem label {
            display: inline-block;
            width: 100px;
        }

    .addLine {
        margin-top: 4px;
        margin-bottom: 4px;
    }
</style>
<script src="~/Scripts/gbh/DaySellMinMax.js"></script>
<h2 style="float: left">จัดการข้อมูล Daysell MinMax รายสินค้า</h2>
<div class="demo-tip icon-tip" style="float: left;">
    &nbsp;
</div>
<div style="clear: both">
</div>
<table id="dgDaySellMinMax" title="จัดการข้อมูล Daysell MinMax รายสินค้า" class="easyui-datagrid"
    style="width: auto; height: 600px;" url="/api/DaySellMinMax/PostGetAllDaySellMinMax" singleselect="true" toolbar="#toolbarNonHr">
    <thead>
        <tr>
            <th field="product_id" width="100" align="center" >รหัสสินค้า
            </th>
            <th field="matName" width="300" align="center" >ชื่อสินค้า
            </th>
            <th field="location_id" width="100" align="center" >Branch
            </th>
            <th field="branchName" width="150" align="center" >ชื่อ Branch
            </th>
            <th field="min" width="50" align="center"  editor="numberbox">Min
            </th>
            <th field="max" width="50" align="center"  editor="numberbox">Max
            </th>
            <th field="rop" width="50" align="center"  editor="numberbox">ROP
            </th>
            <th field="isEnable" width="50" align="center" editor="{type:'checkbox',options:{on:'true',off:'false'}}" >Active
            </th>
        </tr>
    </thead>
</table>
<div id="toolbarNonHr">
    <a id="addDaySellMinMax" href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="addNonHR(true);">Add</a>
    <a id="updateDaySellMinMax" href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="loadEdit();">Edit</a>
    <a id="exportDaySellMinMax" href="#" class="easyui-linkbutton" iconcls="icon-save" plain="true" onclick="exportDaySellMinMax();">Export</a>

    <a id="DeleteDaySellMinMax" style="float:right; color:red" href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteMinMax();">Delete</a>
</div>

<div id="dlgNonHr" class="easyui-dialog" style="width: 400px; height: 350px; padding: 10px 20px"
    closed="true" buttons="#dlgNonHr-buttons1">

    <form id="FormNonHr" method="post" novalidate>
        <div>
            <div class="addLine">
                <label class="fitem">
                    รหัสสินค้า</label>
                <input id="product_id" name="product_id" readonly="readonly">
                <a href="#" id="openSearchPopup" class="easyui-linkbutton" iconcls="icon-search" onclick="openSearchProduct();">ค้นหาสินค้า</a>
            </div>
            <div class="addLine">
                <label class="fitem">
                    รหัส Branch</label>
                <input readonly="readonly" id="location_id" name="location_id" readonly="readonly">
                <a href="#" id="openSearchPopup" class="easyui-linkbutton" iconcls="icon-search" onclick="openSearchBranch();">ค้นหา Branch
                </a>
            </div>
            <div class="addLine">
                <label class="fitem">
                    Branch</label>
                <input readonly="readonly" id="branchName" name="branchName" readonly="readonly">
                
            </div>
            <div class="addLine">
                <label class="fitem">
                    Min.</label>
                <input id="min" name="min" required>
            </div>
            <div class="addLine">
                <label class="fitem">
                    Max.</label>
                <input id="max" name="max" required>
            </div>
            <div class="addLine">
                <label class="fitem">
                    ROP.</label>
                <input id="rop" name="rop" required>
            </div>
            <div class="addLine">
                <label class="fitem">
                    Active</label>
                <input aria-readonly="true" type="checkbox" id="isEnable" name="isEnable">
            </div>
        </div>
    </form>
</div>
<div id="dlgNonHr-buttons1">
    <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="saveMinMax();">Save</a>
    <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#dlgNonHr').dialog('close');">Cancel</a>
</div>


<div id="productSearch" class="easyui-dialog" style="width: 650px; height: 550px; padding: 10px 20px"
    closed="true" buttons="#dlgNonHr-buttons">
    <div>
        <div>
            <label>
                รหัสสินค้า</label>
            <input id="searchProductMatNo">
        </div>
        <div>
            <label>
                ชื่อสินค้าภาษาไทย</label>
            <input id="searchProductNameThai">
        </div>
        <div>
            <label>
                ชื่อสินค้าภาษาอังกฤษ</label>
            <input id="searchProductNameEng">
        </div>
        <div>
            <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="searchProduct()">ค้นหา</a>
        </div>
    </div>
    <table id="dlgProductSearch" title="ค้นหาสินค้า" class="easyui-datagrid"
        style="width: 600px; height: 400px;"
        rownumbers="true" singleselect="true">
        <thead>
            <tr>
                <th field="mmatno" width="150" align="center" >รหัสสินค้า
                </th>
                <th field="mmatthai" width="200" align="center" >ชื่อสินค้า
                </th>
                <th field="mmateng" width="200" align="center" >ชื่อสินค้า อังกฤษ
                </th>
            </tr>
        </thead>
    </table>

</div>
<div id="dlgNonHr-buttons">
    <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="selectProduct();">Select</a>
    <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#productSearch').dialog('close');">Cancel</a>
</div>

<div id="branchSearch" class="easyui-dialog" style="width: 650px; height: 550px; padding: 10px 20px"
    closed="true" buttons="#dlgNonHr-branchSearch">
    <div>
        <div>
            <label>
                รหัส Branch</label>
            <input id="searchBranchNo">
        </div>
        <div>
            <label>
                ชื่อ Branch</label>
            <input id="searchBranchName">
        </div>
        @*<div>
            <label>
                รหัสย่อ Branch</label>
            <input id="searchBranchTrans">
        </div>*@
        <div>
            <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="searchBranch()">ค้นหา</a>
        </div>
    </div>
    <table id="dlgBranchSearch" title="ค้นหา Branch" class="easyui-datagrid"
        style="width: 600px; height: 400px;"
        rownumbers="true" singleselect="true">
        <thead>
            <tr>
                <th field="mbranchno" width="150" align="center" >รหัส Branch
                </th>
                <th field="mprovdesc" width="200" align="center" >ชื่อ Branch
                </th>
                <th field="mprovtrans" width="200" align="center" >รหัสย่อ Branch
                </th>
            </tr>
        </thead>
    </table>

</div>
<div id="dlgNonHr-branchSearch">
    <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="selectBranch();">Select</a>
    <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#branchSearch').dialog('close');">Cancel</a>
</div>
